#pragma once
#include<fcntl.h>
#include<cstring>
#include<cerrno>
#include"Log.hpp"
#include"Err.hpp"


class Util
{
public:
    static bool SetNonBlock(int fd)
    {
        int fl = fcntl(fd, F_GETFL);
        if(fl < 0)
        {
            LogMessage(WARNING,"no get FL! code :%d,strerror %s",errno,strerror(errno));
            return false;

        }
        fcntl(fd, F_SETFL, fl | O_NONBLOCK);
        return true;
    }
};